<template>
	<view>
		<p-navbar title=""></p-navbar>
		<view class="hq">
			<view>提币地址</view>
		</view>
		<view class="fooler">
			<view class="fooler-title3" v-for="(item,index) in bilei" :key="index" style="line-height: 40rpx;padding: 20rpx 0rpx;">
				<view class="title3" @tap="split(item,index)">
					<!-- <image :src="check==index?img.show:img.hide"></image> -->
					<!-- <image src="../../static/show2.png"></image> -->
					<view>
						<view class="child">{{item.name}}</view>
						<view class="child">{{item.withdrawAddress}}</view>
					</view>
				</view>
				<view class="text1" style="width: 10%" @tap="del(item,index)">删除</view>

			</view>
		</view>
		
		<hide v-if="bilei.length=='0'"/>
		<view class="submit">
			<u-button type="primary" ripple shape="circle" @click="fnRegister">添加地址</u-button>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				loading: false,
				img: {
					hide: '/static/show3.png',
					show: '/static/show2.png',
				},
				bilei: [],
				type: '',
				list: [],
				check: null,
				prson: {},
			}
		},
		onShow() {
			this.type = 0;
			this.WalletList()
		},
		methods: {
			WalletList(){
				this.request.post('coinWithdrawAddress/list').then(res => {
					this.bilei=res.data.data
				})
			},
			del(item, index) {
				uni.showModal({
					// title: '提示',
					content: '您确定删除吗?',
					success: (res)=> {
						if (res.confirm) {
							this.request({
								url:'coinWithdrawAddress/delete',
								params: {id:item.id}
							
							}).then(res => {
								if(res.data.code=='1'){
									this.util.toast('删除成功')
									this.WalletList()
								}
							})
						}
					}
				});
			},
			navbar() {
				// console.log(this.prson)
				if(!this.prson.cid) return ;
				uni.$emit('update', JSON.stringify(this.prson))
				uni.navigateBack({
					delta: 1,
				})
			},
			fnRegister() {
				this.loading = true
				this.$Router.push({ path: '/pages/user/address-item'})
			},
			split(item, index) {
				this.check = index
				this.prson = item
				uni.$emit('update', JSON.stringify(this.prson))
				uni.navigateBack({
					delta: 1,
				})
			},
			nav(item) {
				uni.navigateTo({
					url: item
				})
			},
			click(e) {
				console.log(e)
			},
		}
	}
</script>

<style lang="scss">
	page{
		margin: 30rpx;
		width: 92%;
	}
	.hq {
		display: flex;
		justify-content: space-between;
		padding-left: 10rpx;
		// background: #333;
		// height: 110rpx;
		font-size: 38rpx;
		font-family: PingFang SC;
		font-weight: bold;
		line-height: 52px;
		color: #333;
		border-bottom: 1rpx solid $border;
	}

	.fooler {
		// background: #333;

		.fooler-title3 {
			display: flex;
			justify-content: space-between;
			// line-height: 70rpx;
			border-bottom: 1rpx solid $border;

			.title3 {
				width: 80%;
				// width: 20%;
				display: flex;
				align-items: center;
				image {
					margin: 0rpx 20rpx 0rpx 10rpx;
					width: 36rpx;
					height: 36rpx;
				}

				.child {
					width: 400rpx;
					overflow: hidden;
					text-overflow: ellipsis;
					font-size: 24rpx;
					font-family: PingFang SC;
					font-weight: bold;
					// line-height: 60rpx;
					color: #333;
				}
			}
		}
	}

	.text1 {
		width: 150rpx;
		display: flex;
		align-items: center;
		font-size: 28rpx;
		font-family: PingFang SC;
		font-weight: bold;
		color: #E31345;
	}

	.submit {
		margin: 50rpx 0rpx 20rpx;
		position: fixed;
		left: 50rpx;
		bottom: 0rpx;

		/deep/ .u-btn {
			background-color: #F3C31B !important;
			// box-shadow: 0 17rpx 40rpx rgba(#2196F3, .3);
			transition: .3s;
			height: 90rpx;
			width: 650rpx;
			border-radius: 20rpx;
		}

		/deep/ .u-round-circle::after {
			/* border-radius: 50px; */
			border-radius: 20rpx;
		}
	}
	.swiper-text{
		margin-top: 50rpx;
		// width: 100%;
		text-align: center;
		font-size: 26rpx;
		font-family: PingFang SC;
		font-weight: 400;
		line-height: 36rpx;
		color: #999999;
		image{
			width: 186rpx;
			height: 201rpx;
			margin-bottom: 20rpx
		}
	}
</style>
